import prompt from '@system.prompt';
import tabbarItems from '../../common/datas/datas.js';

export default {
    data: {
        datas: {},
        fresh: false,
        date: [
            { id: '一', color: '#FF0000' },
            { id: '二', color: '#FF7D00' },
            { id: '三', color: '#FFFF00' },
            { id: '四', color: '#00FF00' },
            { id: '五', color: '#00FFFF' },
            { id: '六', color: '#0000FF' },
            { id: '日', color: '#FF00FF' },
        ],
        tabBar1: [
            { name: '鼻气流', data: '16次/分' },
            { name: '鼾声', data: '60分贝' },
            { name: '心率', data: '89次/分' },
            { name: '血氧', data: '83%' },
        ],
        tabBar: {
            tabBar1: [
                {name: '鼻气流', data: '16次/分'},
                {name: '鼾声', data: '60分贝'},
                {name: '心率', data: '89次/分'},
                {name: '血氧', data: '83%'},
            ],
            tabBar2: [
                {name: '鼻气流', data: '16次/分'},
                {name: '鼾声', data: '60分贝'},
                {name: '心率', data: '89次/分'},
                {name: '血氧', data: '83%'},
            ],
            tabBar3: [
                {name: '鼻气流', data: '16次/分'},
                {name: '鼾声', data: '60分贝'},
                {name: '心率', data: '89次/分'},
                {name: '血氧', data: '83%'},
            ],
            tabBar4: [
                {name: '鼻气流', data: '16次/分'},
                {name: '鼾声', data: '60分贝'},
                {name: '心率', data: '89次/分'},
                {name: '血氧', data: '83%'},
            ],
        },
        lineData1: [
            {
                fillColor: '#2688f0',
                data: [763, 550, 551, 554, 731, 654, 525, 696, 595, 628,763, 550, 551, 554, 731, 654, 525, 696, 595, 628,763, 550, 551, 554, 731, 654, 525, 696, 595, 628],
            },
        ],
        lineOps1: {
            xAxis: {
                min: 0,
                max: 30,
                display: true,
                axisTick: 20,
            },
            yAxis: {
                min: 0,
                max: 1000,
                display: true,
            },
        },
        lineData2: [
            {
                strokeColor: '#3F95C2',
                fillColor: '#3F95C2',
                data: [763, 550, 551, 554, 731, 654, 525, 696, 595, 628, 791, 505, 613, 575, 475, 553, 491, 680, 657, 716],
                gradient: true,
            }
        ],
        lineOps2: {
            xAxis: {
                min: 0,
                max: 20,
                display: true,
            },
            yAxis: {
                min: 0,
                max: 1000,
                display: true,
            },
            series: {
                lineStyle: {
                    width: "5px",
                    smooth: true,
                },
                headPoint: {
                    shape: "circle",
                    size: 20,
                    strokeWidth: 5,
                    fillColor: '#ffffff',
                    strokeColor: '#3F95C2',
                    display: true,
                },
                loop: {
                    margin: 2,
                    gradient: true,
                }
            }
        },
        lineData3: [
            {
                strokeColor: '#F39C35',
                fillColor: '#F39C35',
                data: [763, 550, 551, 554, 731, 654, 525, 696, 595, 628, 791, 505, 613, 575, 475, 553, 491, 680, 657, 716],
                gradient: true,
            }
        ],
        lineOps3:
        {
            xAxis: {
                min: 0,
                max: 20,
                display: true,
            },
            yAxis: {
                min: 0,
                max: 1000,
                display: true,
            },
            series: {
                lineStyle: {
                    width: "5px",
                    smooth: true,
                },
                headPoint: {
                    shape: "circle",
                    size: 20,
                    strokeWidth: 5,
                    fillColor: '#ffffff',
                    strokeColor: '#3F95C2',
                    display: true,
                },
                loop: {
                    margin: 2,
                    gradient: true,
                }
            }
        },
        lineData4: [
            {
                strokeColor: '#0081ff',
                fillColor: '#0081ff',
                data: [763, 550, 551, 554, 731, 654, 525, 696, 595, 628, 791, 505, 613, 575, 475, 553, 491, 680, 657, 716,525, 696, 595, 628, 791, 505, 613, 575, 475, 553,],
                gradient: true,
            }
        ],
        lineOps4:
        {
            xAxis: {
                min: 0,
                max: 30,
                display: true,
                axisTick: 30,
            },
            yAxis: {
                min: 0,
                max: 1000,
                display: true,
            },
            series: {
                lineStyle: {
                    width: "5px",
                    smooth: true,
                },
                headPoint: {
                    shape: "circle",
                    size: 20,
                    strokeWidth: 5,
                    fillColor: '#ffffff',
                    strokeColor: '#3F95C2',
                    display: true,
                },
                loop: {
                    margin: 2,
                    gradient: true,
                }
            }
        },
    },
    change: function(e) {
        console.log("Tab index: " + e.index);
    },
    addData() {
        this.$refs.linechart.append({
            serial: 0,
            data: [Math.floor(Math.random() * 400) + 400]
        })
    },
    onInit() {
        this.list = [];
        for(var i=0; i<=3; i++) {
            var item = '列表元素' + i;
            this.list.push(item);
        }
    },
    // 下拉刷新
    refresh: function (e) {
        prompt.showToast({
            message: '刷新中···'
        })
        var that = this;
        that.fresh = e.refreshing;
        setTimeout(function () {
            that.fresh = false;
            var addItem = '更新元素';
            that.list.unshift(addItem);
            prompt.showToast({
                message: '刷新完成'
            })
        }, 2000)
    }
}